package com.ssy.lingxi.pay.controller.pc;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.pay.model.vo.request.CreditRequestVO;
import com.ssy.lingxi.pay.model.vo.request.CreditVORequest;
import com.ssy.lingxi.pay.model.vo.response.CreditVO;
import com.ssy.lingxi.pay.service.ICreditService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @menu 支付与结算能力-授信
 * @author 伍将
 * @date 2020/11/3
 * @version 2.0.0
 */
@RestController
@RequestMapping("/pay/credit")
public class CreditController extends BaseController {

    @Resource
    private ICreditService creditService;

    /**
     * 获取授信
     * @author 伍将
     * @date 2020/11/3
     **/
    @RequestMapping(value = "/getCredit", method = RequestMethod.GET)
    public Wrapper<CreditVO> getCredit(HttpServletRequest httpRequest, @Valid CreditVORequest request) {
        return creditService.getCredit(getSysUser(httpRequest), request);
    }

    /**
     * 获取会员授信
     * @author 伍将
     * @date 2020/12/28
     **/
    @RequestMapping(value = "/getMemberCredit", method = RequestMethod.GET)
    public Wrapper<CreditVO> getMemberCredit(HttpServletRequest httpRequest, @Valid CreditRequestVO request) {
        return creditService.getMemberCredit(getSysUser(httpRequest), request);
    }
}
